package cn.psvmc.cxzapi.mapper.customer;

import cn.psvmc.cxzapi.config.mybatisplus.mapper.MyBaseMapper;
import cn.psvmc.cxzapi.model.common.SearchEntity;
import cn.psvmc.cxzapi.model.customer.TCustomer;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;

import java.util.Map;

/**
 * 客户表 Mapper 接口
 * @Author auto
 * @Date 2024-08-12
 */
public interface TCustomerMapper extends MyBaseMapper<TCustomer> {

    Map<String, Object> findByPhone(@Param("phone") String phone);

    //选择列表
    IPage<Map> listForSel(Page<TCustomer> queryPage, @Param("entity") SearchEntity entity);

    //管理列表
    IPage<Map> listAll(Page<TCustomer> iPage,@Param("entity") SearchEntity entity);

    //根据用户ID获取客户信息
    Map<String, Object> findByUserId(@Param("userid") String userid);

    //根据客户ID获取授权信息
    TCustomer getAuthByCustomerId(@Param("customerid") Integer customerid);

    //根据客户ID获取手机号
    String getPhoneById(@Param("customerid") Integer customerid);

    //根据客户ID获取支付宝唯一用户标识
    String getOpenIdByCustomerId(@Param("customerid") Integer customerid);

    //更新签章图片
    void updateCustomerSeal(@Param("customerid") Integer customerid, @Param("customerSeal") String customerSeal);

    //根据客户ID获取客户姓名和身份证号码
    Map getNameAndIdNumber(@Param("customerid") Integer customerid);

    //根据支付宝id获取客户id
    Integer getCustomerIdByOpenid(@Param("openid") String openid);

    //更新客户支付宝业务卡号
    void updateBizCardNoByOpenid(@Param("bizCardNo") String bizCardNo, @Param("openId") String openId);

    //根据客户ID获取支付宝业务卡号
    String getBizCardNoByCustomerId(@Param("customerid") int customerid);

    //更新客户会员卡基础信息
    void updateCardInfoByOpenId(@Param("customer") TCustomer customer);
}
